package mkis.service.root.data.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

import mkis.service.root.data.model.Member;

@Repository("memberDAO")
public class MemberDAO {

	@Resource(name="sqlMapClient")
	private SqlMapClient sqlMapClient;
	
	public Member getMember(Map<String, Object> queryParam) throws Exception {
		return (Member) sqlMapClient.queryForObject("member.getMember", queryParam);
	}

	public Member getLoginMember(Map<String, Object> queryParam) throws Exception {
		return (Member) sqlMapClient.queryForObject("member.getLoginMember", queryParam);
	}

	public List<Member> getMemberList(Map<String, Object> paramMap) throws Exception {
		return sqlMapClient.queryForList("member.getMemberList", paramMap);
	}

	public int getMemberListCnt(Map<String, Object> paramMap)  throws Exception {
		return (Integer) sqlMapClient.queryForObject("member.getMemberListCnt", paramMap);
	}

	public int updateMember(Member member) throws Exception {
		return (Integer)sqlMapClient.update("member.updateMember",member);
	}

	public int outMember(Map<String, Object> queryParam) throws Exception {
		return (Integer)sqlMapClient.update("member.outMember",queryParam);
	}

	public int insertMember(Member member) throws Exception {
		sqlMapClient.insert("member.insertMember",member);
		return 1;
	}

	public int checkOrgList(List<String> paramList) throws Exception {
		return (Integer) sqlMapClient.queryForObject("member.checkOrgList", paramList);
	}

}
